<!DOCTYPE html>

<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->

<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->

<!--[if !IE]><!-->

<html lang="en" class="no-js">

<!--<![endif]-->

<!-- BEGIN HEAD -->

<head>

    <include file="Inc/basic_css"/>

    <include file="Inc/basic_js"/>

    <import type="js" basepath="__JS__" file="AjaxFileUpload,imgpre,admin" />

    <import type="js" basepath="__PLUGIN__" file="ueditor.ueditor#config,ueditor.ueditor#all#min,ueditor.lang.zh-cn.zh-cn" />

    <link rel="stylesheet" type="text/css" href="__PLUGIN__/bootstrap-datepicker/css/datepicker.css" />

    <script type="text/javascript" src="__PLUGIN__/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>



</head>

<!-- END HEAD -->

<!-- BEGIN BODY -->

<body class="page-header-fixed">

<!-- BEGIN HEADER -->

<include file="Inc/head"/>

<!-- END HEADER -->

<div class="clearfix"></div>

<!-- BEGIN CONTAINER -->

<div class="page-container">

    <!-- BEGIN SIDEBAR -->

    <include file="Inc/left"/>

    <!-- END SIDEBAR -->

    <!-- BEGIN PAGE -->

    <div class="page-content">



        <!-- BEGIN STYLE CUSTOMIZER -->

        <include file="Inc/theme"/>

        <!-- END BEGIN STYLE CUSTOMIZER -->

        <!-- BEGIN PAGE HEADER-->

        <div class="row">

            <div class="col-md-12">

                <!-- BEGIN PAGE TITLE & BREADCRUMB-->

                <h3 class="page-title">

                    {$cfg.title}<if condition="$order.id gt 0 ">详情信息<else />详情信息</if> <small></small>

                </h3>

                <ul class="page-breadcrumb breadcrumb">

                    <li><i class="fa fa-home"></i><a href="{:U('Index/index')}">首页</a> <i class="fa fa-angle-right"></i></li>

                    <li><a href="#">意向客户</a><i class="fa fa-angle-right"></i></li>

                    <li><a href="#">{$cfg.title}<if condition="$order.id gt 0 ">修改信息<else />订单管理</if></a></li>

                </ul>                   <!-- END PAGE TITLE & BREADCRUMB-->

            </div>

        </div>

        <!-- END PAGE HEADER-->

        <!-- BEGIN PAGE CONTENT-->

        <div class="row">

            <div class="col-md-12">

                <!-- BEGIN EXAMPLE TABLE PORTLET-->

                <div class="portlet">

                    <form class="form-horizontal" action="{:U('Buyers/save')}"  id="submit_form" method="Post">

                        <input type="hidden" name="id" value="{$order.id}" />
                        <input type="hidden" name="member_id" value="{$order.member_id}" />
                        <input type="hidden" name="order_no" value="{$order.order_no}" />
                        <input type="hidden" name="order_no_small" value="{$order.order_no_small}" />

                        <input type="hidden" name="back_url" value="{$back_url}" />

                        <div class="portlet-body form">

                            <!-- BEGIN FORM-->

                        <div class="form-body">

                            <div class="portlet box blue">

                                    <div class="portlet-title">

                                        <div class="caption"><i class="fa fa-gift"></i>订单信息</div>

                                        <div class="tools">
                                            <a href="javascript:;" class="collapse"></a>
                                            <a href="#portlet-config" data-toggle="modal" class="config"></a>
                                            <a href="javascript:;" class="reload"></a>
                                            <a href="javascript:;" class="remove"></a>
                                        </div>

                                    </div>

                                    <div class="portlet-body">

                                        <div class="table-responsive">

                                            <table class="table table-bordered table-hover">

                                                <thead>

                                                <tr>

                                                    <th  >预付款订单号</th>

                                                    <!-- <th  >订单状态</th> -->

                                                    <!-- <th >下单用户名</th> -->

                                                    <th>下单时间</th>

                                                    <th>预约时间</th>

                                                    <th>订单总价</th>

                                                    <th>预付款</th>
                                                    <th>额外费用</th>

                                                </tr>
                                                </thead>
                                                <tbody>
                                                <tr>
                                                    <td  class="active">{$order.order_no}</td>
                                                    <!-- <td  >{$statusArr[$order['status']]['status']}</td> -->
                                                    <!-- <td  > {$order.member}</td> -->
                                                    <td><input type="text" id="addtime" name="addtime" value='{$order.addtime}'></td>
                                                    <td> <input type="text" name="booktime" value='{$order.booktime}'></td>
                                                    <td  class="success"> <input type="text" name="total_price" value='{$order.total_price}'></td>
                                                    <td  class="danger"> <input type="text" name="advance_price" value='{$order.advance_price}'></td>
                                                     <td  class="warning"> <input type="text" name="extra_price" value='{$order.extra_price}'></td>
                                                </tr>
                                                <tr>

                                                    <th>尾款订单号</th>

                                                    <th>出发地</th>

                                                    <th>目的地</th>

                                                    <th>联系电话</th>

                                                    <th>尾款</th>

                                                    <th>平地搬运费</th>

                                                    

                                                </tr>

                                                <tr>

                                                    <td  class="active">{$order.order_no_small}</td>

                                                    <td  ><input type="text" name="departure" value='{$order.departure}'></td>

                                                    <td  ><input type="text" name="arrival" value='{$order.arrival}'></td>

                                                    <td  ><input type="text" name="tel" value='{$order.tel}'></td>

                                                    <td  class="danger"> <input type="text" name="small_balance" value='{$order.small_balance}'></td>

                                                    <td  class="warning"> <input type="text" name="move_price" value='{$order.move_price}'></td>

                                                   



                                                </tr>

                                                <tr>

                                                    <th>搬家项目</th>

                                                    <th>搬出楼层</th>

                                                    <th>搬出费用</th>

                                                    <th>搬入楼层</th>

                                                    <th>搬入费用</th>

                                                    <th colspan="2">项目费用总计</th>

                                                </tr>

                                                <PHP>$productInfo=json_decode($order['product_info'],true);</PHP>
                                                <PHP>$floor_cost=json_decode($productList[$productInfo['product_id']]['floor_cost'],true);</PHP>

                                                <tr>

                                                    <td  class="active">
                                                        {$productInfo.product_title}
                                                        <select name="product_id">
                                                            <foreach name='productList' item='pro'>
                                                                <option value="{$pro.id}" <if condition="$productInfo['product_id'] eq $pro['id']">selected</if>>{$pro.title}</option>
                                                            </foreach>
                                                        </select>
                                                    </td>

                                                    <td  >
                                                        {$productInfo.floor_from}
                                                        <select name="floor_from">
                                                            <foreach name='floor_cost' item='fl'>
                                                                <option value="{$fl.title}">{$fl.title}</option>
                                                            </foreach>
                                                        </select>
                                                    </td>

                                                    <td  class="success"><input type="text" name="floor_from_cost" value='{$productInfo.floor_from_cost}'></td>

                                                    <td  > <input type="text" name="floor_to" value='{$productInfo.floor_to}'></td>

                                                    <td  class="success"> <input type="text" name="floor_to_cost" value='{$productInfo.floor_to_cost}'></td>

                                                    <td  class="warning" colspan="2"> <input type="text" name="price" value='{$productInfo.price}'></td>

                                                </tr>

                                                <tr>

                                                    <th>车型</th>

                                                    <th>起价费</th>

                                                    <th>超里程费用</th>

                                                    <th>里程</th>

                                                    <th colspan="3">用车费用总计</th>

                                                </tr>

                                                <PHP>$cartypeInfo=json_decode($order['cartype_info'],true)</PHP>

                                                <tr>
                                                    <td  class="active">
                                                        {$cartypeInfo.cartype_title}
                                                         <select name="cartype_id">
                                                            <foreach name='cartypeList' item='ca'>
                                                                <option value="{$ca.id}" <if condition="$cartypeInfo['cartype_id'] eq $ca['id']">selected</if>>{$ca.title}</option>
                                                            </foreach>
                                                        </select>
                                                    </td>

                                                    <td  class="success" ><input type="text" name="flag_fall_price" value='{$cartypeInfo.flag_fall_price}'></td>

                                                    <td  class="success"><input type="text" name="over_charge" value='{$cartypeInfo.over_charge}'></td>

                                                    <td  ><input type="text" name="mile" value='{$cartypeInfo.mile}'> </td>

                                                    <td  class="warning" colspan="3"><input type="text" name="price" value='{$cartypeInfo.price}'></td>

                                                </tr>

                                                <PHP>$attachment=json_decode($order['attachment'],true)</PHP>

                                                <volist name="attachment.list" id="item">

                                                    <tr>

                                                        <th>附加项目</th>

                                                        <th>规格</th>

                                                        <th>单价</th>

                                                        <th>数量</th>

                                                        <th>费用合计</th>

                                                        <if  condition="$key eq 0"><th colspan="2">附加项目合计</th></if>

                                                    </tr>

                                                    <tr>

                                                        <td>{$item.attachment_title}</td>

                                                        <td>{$item.option}</td>

                                                        <td>{$item.value}</td>

                                                        <td>{$item.num}</td>

                                                        <td class="success">{$item.price}</td>

                                                        <if  condition="$key eq 0"><td  class="warning" rowspan="{:(count($attachment['list'])*2-1)}" colspan="2">{$attachment.price}</td></if>

                                                    </tr>

                                                </volist>

                                                <tr>

                                                    <th>用户备注</th>

                                                    <td colspan="6"><input type="text" name="remark" value="{$item['remark']}">
                                                    <!-- {:($item['remark'])?item['remark']:'无'} -->
                                                </td>

                                                </tr>

                                                </tbody>

                                            </table>

                                        </div>

                                    </div>

                                </div>
                                 <div class="portlet box blue">

                                <div class="portlet-title">

                                    <div class="caption"><i class="fa fa-gift"></i>其他费用</div>

                                    <div class="tools">

                                        <a href="javascript:;" class="collapse"></a>

                                        <a href="#portlet-config" data-toggle="modal" class="config"></a>

                                        <a href="javascript:;" class="reload"></a>

                                        <a href="javascript:;" class="remove"></a>

                                    </div>

                                </div>

                                <div class="portlet-body">

                                    <div class="table-responsive">

                                        <table class="table table-striped table-bordered table-advance table-hover">

                                            <thead>

                                                <foreach name='attachmentList' item='atta' key="index">
                                                    <tr>
                                                        <th align="center">{$atta.title}</th>
                                                        <foreach name='atta.child' item='item' key='key'>
                                                            <td align="left">{$item.option}【{$item.value}】
                                                                <if condition="$item['value'] neq 0">
                                                                <button type="button" class="mus" data-key='{$key}' data-index="{$index}">-</button>
                                                                <input type="" name="num" value="0" style="width:20px" disabled>
                                                                <button type="button" class="add" data-key='{$key}' data-index="{$index}">+</button>
                                                                </if>
                                                            </td>
                                                        </foreach>
                                                    </tr>
                                                </foreach>

                                            </thead>

                                        </table>

                                    </div>

                                </div>
								<input type="hidden" name="attachment" value="" id="attachment">
                            </div>
                            <script type="text/javascript">
                                console.log('开始了')
                                var attachment=eval(<php>echo json_encode($attachmentList);</php>);//规格属性
                                var data = [];
                                $('.add').click(function(){
                                    var key = $(this).data('key');
                                    var index = $(this).data('index');
                                    console.log('父'+index+'子'+key)
                                    ++attachment[index]['child'][key]['num'];
                                    console.log(attachment[index]['child'][key]);
                                    var num =Number($(this).prev().val())+1;
                                    $(this).prev().val(num);
                                    $('#attachment').val(JSON.stringify(attachment));
                                })
                                $('.mus').click(function(){
                                    var key = $(this).data('key');
                                    var index = $(this).data('index');
                                    console.log('父'+index+'子'+key)
                                    if(attachment[index]['child'][key]['num']>0){
                                      --attachment[index]['child'][key]['num'];	
                                    	var num =Number($(this).next().val())-1;
                                    	$(this).next().val(num);
                                    }
                                    // console.log(attachment[index]['child'][key]);
                                    // console.log(attachment);
                                    $('#attachment').val(JSON.stringify(attachment));
                                })
                                // console.log(attachment)
                            </script>

                            <!-- <div class="portlet box green">

                                <div class="portlet-title">

                                    <div class="caption"><i class="fa fa-gift"></i>车辆分配信息</div>

                                    <div class="tools">

                                        <a href="javascript:;" class="collapse"></a>

                                        <a href="#portlet-config" data-toggle="modal" class="config"></a>

                                        <a href="javascript:;" class="reload"></a>

                                        <a href="javascript:;" class="remove"></a>

                                    </div>

                                </div>

                                <div class="portlet-body">

                                    <div class="table-responsive">

                                        <table class="table table-striped table-bordered table-advance table-hover">

                                            <thead>

                                            <tr>

                                                <th align="center">司机姓名</th>

                                                <th align="center">车牌号</th>

                                                <th align="center" >司机联系电话</th>

                                                <th align="center" >司机状态</th>

                                                <th align="center" >司机装货照片</th>

                                                <th align="center" >二联单图片</th>



                                            </tr>

                                            </thead>

                                            <tbody>

                                                <tr>

                                                    <td align="center">

                                                        <if condition="$order['status'] eq 1 or $order['status'] eq 2">

                                                            <select class="form-control input-small" name="driver_id">

                                                                <volist name="driverList" id="vo">

                                                                    <option value="{$vo.id}">{$vo.realname}</option>

                                                                </volist>

                                                            </select>

                                                        <else />

                                                            {$order.driver_name}

                                                        </if>

                                                    </td>

                                                    <td align="center">{$order.car_name}</td>

                                                    <td align="center" >{$order.dirver_tel}</td>

                                                    <td align="center" >{$statusdetail[$order['driver_status']]}</td>

                                                    <td align="center" >

                                                        <a title="点击预览" data-toggle="modal" href="#img_preview" onclick="$('#preview').attr('src','__UPLOAD__/{$order.driver_pic}')"><img src="__UPLOAD__/{$order.driver_pic}" width="80" height="80" rel="__UPLOAD__/{$order.driver_pic}" class="preview" /></a>

                                                    </td>

                                                    <td align="center" >

                                                        <a title="点击预览" data-toggle="modal" href="#img_preview" onclick="$('#preview').attr('src','__UPLOAD__/{$order.double_sheet}')"><img src="__UPLOAD__/{$order.double_sheet}" width="80" height="80" rel="__UPLOAD__/{$order.double_sheet}" class="preview" /></a>

                                                    </td>

                                                </tr>

                                            </tbody>

                                        </table>

                                    </div>

                                </div>

                            </div> -->





                                <div class="form-actions top fluid ">

                            <div class="col-md-offset-3 col-md-9">

                                <!-- <if condition="$order['status'] eq 1 or $order['status'] eq 2">
                                    <button class="btn green" type="submit"  href="#basic">分配司机</button>
                                </if> -->
                                <button class="btn green" type="submit"  href="#basic">帮助下单</button>
                                <button class="btn default" type="button" id="cancel" onclick="history.go(-1)">返回</button>
                            </div>

                        </div>



                            </div>

                        </div>



                    </form>

                    <!-- END FORM-->

                </div>

            </div>

            <!-- END EXAMPLE TABLE PORTLET-->

        </div>

    </div>

    <!-- END PAGE CONTENT -->

</div>

<div id="img_preview" class="modal fade modal-scroll" tabindex="-1" data-replace="true" style="display: none;" aria-hidden="true">

    <div class="modal-dialog">

        <div class="modal-content">

            <div class="modal-header">

                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>

                <h4 class="modal-title">图片预览</h4>

            </div>

            <div class="modal-body">

                <img id="preview" style="width: 540px" alt="" src="">

            </div>

            <div class="modal-footer">

                <button type="button" data-dismiss="modal" class="btn green">Close</button>

            </div>

        </div>

    </div>

</div>

<!-- END CONTAINER -->

<!-- BEGIN FOOTER -->

<include file="Inc/foot"/>

<!-- END FOOTER -->

<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->



<!-- END CORE PLUGINS -->

<!-- BEGIN PAGE LEVEL SCRIPTS -->

<script src="__JS__/app.js" type="text/javascript"></script>

<script src="__JS__/form-components.js"></script>

<script src="__JS__/controllers/new/edit.js" type="text/javascript"></script>

<!-- END PAGE LEVEL SCRIPTS -->

<script>

    jQuery(document).ready(function() {

        App.init(); // initlayout and core plugins

        NewValidation.init();

        FormComponents.init();

    });

</script>

<script language="javascript">



    function findNext(v , e , dom){

        var selValue = parseInt(v);

        var areaNextId = parseInt(e+1);

        $("#"+dom+"_"+areaNextId).remove();

        $("#"+dom+"_"+e+" > select > option").each(function(i){

            if($(this).attr('value') == v){

                $(this).attr('selected',true);

            }

        });





        var data = { r: Math.random(),selValue: selValue,areaNextId: areaNextId ,domId: dom};

        $.ajax({type:"GET", url:"<php>echo U('ScenicArea/ajaxFindNext');</php>",data: data, dataType:"text",async:false,success:function (msg){

        r = msg;

        }});

    if (r==0) {

        return false;

    } else {

        r='<div class="radio-inline">'+r+'</div>';

        $('#'+dom+'_'+e).append(r);

        return true;

    }





    }



    $(function(){

        {$content}

    });



</script>

</body>

<!-- END BODY -->

</html>